import random

def generate_test_cases(num_cases=5, min_length=5, max_length=20, min_height=0, max_height=10):
    """
    生成测试用例
    :param num_cases: 测试用例数量
    :param min_length: 最小数组长度
    :param max_length: 最大数组长度
    :param min_height: 最小高度
    :param max_height: 最大高度
    :return: 测试用例列表
    """
    test_cases = []
    for _ in range(num_cases):
        length = random.randint(min_length, max_length)
        height = [random.randint(min_height, max_height) for _ in range(length)]
        test_cases.append(height)
    return test_cases

def save_test_cases(test_cases, filename="test_cases.txt"):
    """
    保存测试用例到文件
    """
    with open(filename, "w") as f:
        for case in test_cases:
            f.write(str(case) + "\n")

if __name__ == "__main__":
    # 生成测试用例
    test_cases = generate_test_cases()
    # 保存测试用例
    save_test_cases(test_cases)
    print("测试用例已生成并保存到 test_cases.txt") 